﻿<Window x:Class=" MoneyManagerNET.Presentation.View.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:view="clr-namespace:MoneyManagerNET.Presentation.View"
        xmlns:vm="clr-namespace:MoneyManagerNET.Presentation.ViewModel;assembly=MoneyManagerNET.Presentation.ViewModel"
        xmlns:mvvm="clr-namespace:Mvvm.Infrastructure;assembly=Mvvm"
        Title="MainWindow" Height="350"  Width="525" 
        mc:Ignorable="d"   
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:my="clr-namespace:MoneyManagerNET"  Loaded="Window_Loaded" Background="#EEE"
  d:DataContext="{x:Static vm:DesignTimeViewModelSupplier.Main}"

    >
  
    <Window.Resources>
        
    	<Storyboard x:Key="kuku">
    		<ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="gridSplitter1">
    			<EasingThicknessKeyFrame KeyTime="0:0:0.4" Value="-5,40,0,40">
    				<EasingThicknessKeyFrame.EasingFunction>
    					<BackEase EasingMode="EaseInOut" Amplitude="5"/>
    				</EasingThicknessKeyFrame.EasingFunction>
    			</EasingThicknessKeyFrame>
    		</ThicknessAnimationUsingKeyFrames>
    		<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="gridSplitter1">
    			<EasingColorKeyFrame KeyTime="0:0:0.4" Value="#FFF36614">
    				<EasingColorKeyFrame.EasingFunction>
    					<CircleEase EasingMode="EaseInOut"/>
    				</EasingColorKeyFrame.EasingFunction>
    			</EasingColorKeyFrame>
    		</ColorAnimationUsingKeyFrames>
    	</Storyboard>
    	<Style x:Key="ExpanderRightHeaderStyle" TargetType="{x:Type ToggleButton}">
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type ToggleButton}">
    					<Border Padding="{TemplateBinding Padding}">
    						<Grid Background="Transparent" SnapsToDevicePixels="False">
    							<Grid.RowDefinitions>
    								<RowDefinition Height="19"/>
    								<RowDefinition Height="*"/>
    							</Grid.RowDefinitions>
    							<Grid>
    								<Grid.LayoutTransform>
    									<TransformGroup>
    										<TransformGroup.Children>
    											<TransformCollection>
    												<RotateTransform Angle="-90"/>
    											</TransformCollection>
    										</TransformGroup.Children>
    									</TransformGroup>
    								</Grid.LayoutTransform>
    								<Ellipse x:Name="circle" HorizontalAlignment="Center" Height="19" Stroke="DarkGray" VerticalAlignment="Center" Width="19"/>
    								<Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" Stroke="#666" StrokeThickness="2" VerticalAlignment="Center"/>
    							</Grid>
    							<ContentPresenter HorizontalAlignment="Center" Margin="0,4,0,0" Grid.Row="1" RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Top"/>
    						</Grid>
    					</Border>
    					<ControlTemplate.Triggers>
    						<Trigger Property="IsChecked" Value="true">
    							<Setter Property="Data" TargetName="arrow" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
    						</Trigger>
    						<Trigger Property="IsMouseOver" Value="true">
    							<Setter Property="Stroke" TargetName="circle" Value="#FF3C7FB1"/>
    							<Setter Property="Stroke" TargetName="arrow" Value="#222"/>
    						</Trigger>
    						<Trigger Property="IsPressed" Value="true">
    							<Setter Property="Stroke" TargetName="circle" Value="#FF526C7B"/>
    							<Setter Property="StrokeThickness" TargetName="circle" Value="1.5"/>
    							<Setter Property="Stroke" TargetName="arrow" Value="#FF003366"/>
    						</Trigger>
    					</ControlTemplate.Triggers>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    	<Style x:Key="ExpanderUpHeaderStyle" TargetType="{x:Type ToggleButton}">
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type ToggleButton}">
    					<Border Padding="{TemplateBinding Padding}">
    						<Grid Background="Transparent" SnapsToDevicePixels="False">
    							<Grid.ColumnDefinitions>
    								<ColumnDefinition Width="19"/>
    								<ColumnDefinition Width="*"/>
    							</Grid.ColumnDefinitions>
    							<Grid>
    								<Grid.LayoutTransform>
    									<TransformGroup>
    										<TransformGroup.Children>
    											<TransformCollection>
    												<RotateTransform Angle="180"/>
    											</TransformCollection>
    										</TransformGroup.Children>
    									</TransformGroup>
    								</Grid.LayoutTransform>
    								<Ellipse x:Name="circle" HorizontalAlignment="Center" Height="19" Stroke="DarkGray" VerticalAlignment="Center" Width="19"/>
    								<Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" Stroke="#666" StrokeThickness="2" VerticalAlignment="Center"/>
    							</Grid>
    							<ContentPresenter Grid.Column="1" HorizontalAlignment="Left" Margin="4,0,0,0" RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Center"/>
    						</Grid>
    					</Border>
    					<ControlTemplate.Triggers>
    						<Trigger Property="IsChecked" Value="true">
    							<Setter Property="Data" TargetName="arrow" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
    						</Trigger>
    						<Trigger Property="IsMouseOver" Value="true">
    							<Setter Property="Stroke" TargetName="circle" Value="#FF3C7FB1"/>
    							<Setter Property="Stroke" TargetName="arrow" Value="#222"/>
    						</Trigger>
    						<Trigger Property="IsPressed" Value="true">
    							<Setter Property="Stroke" TargetName="circle" Value="#FF526C7B"/>
    							<Setter Property="StrokeThickness" TargetName="circle" Value="1.5"/>
    							<Setter Property="Stroke" TargetName="arrow" Value="#FF003366"/>
    						</Trigger>
    					</ControlTemplate.Triggers>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    	
      
    </Window.Resources>
	<Window.Triggers>
		<EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="gridSplitter1">
			<BeginStoryboard x:Name="kuku_BeginStoryboard" Storyboard="{StaticResource kuku}"/>
		</EventTrigger>
		<EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="gridSplitter1">
			<RemoveStoryboard BeginStoryboardName="kuku_BeginStoryboard"/>
		</EventTrigger>
	</Window.Triggers>


    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>

        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <ToolBarPanel HorizontalAlignment="Stretch" Grid.ColumnSpan="2" Name="toolBarPanel1"  >
            <ToolBar >
            	<ToolBar.Resources>
            		<Style TargetType="Image">
            			<Setter Property="Width" Value="32"/>
						<Setter Property="Height" Value="32"/>       		
					</Style>        	
				</ToolBar.Resources>
                <Button Command="{Binding CreateAccountCommand}" ToolTip="Create account" >
                    <Image Source="/Resources/newacct.png" />
                </Button>
                <Button Command="{Binding ManageCategoriesCommand}" ToolTip="Manage categories">
                    <Image Source="/Resources/categoryedit.png" />
                </Button>
                <Button Command="{Binding ManageContragentCommand}">
                    <Image Source="/Resources/payees.png" />
                </Button>
                <Menu>
                <MenuItem Header="relocate">
                    <MenuItem Header="Category" Command="{Binding Path=RelocateByCategoryCommand}"/>
                    <MenuItem Header="Payer" Command="{Binding Path=RelocateByContargentCommand}" />
                </MenuItem>
                </Menu>

            </ToolBar>

            

        </ToolBarPanel>

        <Border BorderThickness="2,1,1,1"  Grid.Row="1" BorderBrush="#FFBBBBBB"  >
            <ListBox   ItemsSource="{Binding ItemsView}" IsSynchronizedWithCurrentItem="True" MouseDown="Expander_MouseDown">
            	
                <ListBox.ItemTemplate >
                    <DataTemplate>
                        <Expander MouseDown="Expander_MouseDown" >
                        	<Expander.Header>
                                <TextBlock Text="{Binding Name}"/>                		
							</Expander.Header>
                            <ListBox  BorderBrush="{x:Null}" ItemsSource="{Binding ItemsView}" IsSynchronizedWithCurrentItem="True" MouseDown="Expander_MouseDown" ItemContainerStyle="{DynamicResource ListBoxItemStyle1}" >
                            	<ListBox.Resources>
                            		<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
                            			<Setter Property="Background" Value="Transparent"/>
                            			<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                            			<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                            			<Setter Property="Padding" Value="2,0,0,0"/>
                            			<Setter Property="Template">
                            				<Setter.Value>
                            					<ControlTemplate TargetType="{x:Type ListBoxItem}">
                            						<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{x:Null}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                            							<VisualStateManager.VisualStateGroups>
                            								<VisualStateGroup x:Name="CommonStates">
                            									<VisualState x:Name="Normal"/>
                            									<VisualState x:Name="MouseOver"/>
                            									<VisualState x:Name="Disabled"/>
                            								</VisualStateGroup>
                            							</VisualStateManager.VisualStateGroups>
                            							<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            						</Border>
                            						<ControlTemplate.Triggers>
                            							<Trigger Property="IsSelected" Value="true">
                            								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                            								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
                            							</Trigger>
                            							<MultiTrigger>
                            								<MultiTrigger.Conditions>
                            									<Condition Property="IsSelected" Value="true"/>
                            									<Condition Property="Selector.IsSelectionActive" Value="false"/>
                            								</MultiTrigger.Conditions>
                            								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                            								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                            							</MultiTrigger>
                            							<Trigger Property="IsEnabled" Value="false">
                            								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            							</Trigger>
                            						</ControlTemplate.Triggers>
                            					</ControlTemplate>
                            				</Setter.Value>
                            			</Setter>
                            		</Style>
                            	</ListBox.Resources>
                            	<ListBox.ItemTemplate>
                            		<DataTemplate >
                            			<Grid>
                            				<TextBlock TextWrapping="Wrap" Text="{Binding Name}" d:LayoutOverrides="Width, Height"/>
                            			</Grid>
                            		</DataTemplate>                    	
								</ListBox.ItemTemplate>
                            	
                            </ListBox>
                        </Expander>
                    </DataTemplate>
                </ListBox.ItemTemplate>
				
            </ListBox>
        </Border>
        
        
        
        <GridSplitter Grid.Row="1" Grid.Column="1"  Background="#88A0A0A0" RenderTransformOrigin="0.5,0.5"  HorizontalAlignment="Left" Name="gridSplitter1" VerticalAlignment="Stretch" Width="10" Margin="-5,30,0,30"  ShowsPreview="True" Panel.ZIndex="1000">
          
            
        </GridSplitter>

        <ContentControl mvvm:View.Model="{Binding Selected}"  Grid.Column="1" Grid.Row="1" ></ContentControl>

    </Grid>


</Window>
